rxapi.exe - when is it used?

RMG :
When it is needed.
The rxapi process manages all of the queues,
plus the registrations of external libraries and the macrospace.
Until one of those APIs is called, it does not get started.
Calling an external function would likely be the first event
that would trigger the launch since that search order uses
both the macrospace and registration apis to search for the target.


=============================================================

QUERY_MACRO
    LocalMacroSpaceManager.cpp : LocalMacroSpaceManager::queryMacro
            RoutineClass.cpp : RoutineClass::processInstore
            RexxActivation.cpp : RexxActivation::callMacroSpaceFunction <-- now controlled by options MACROSPACE / NOMACROSPACE
                ExternalFunctions.cpp : SystemInterpreter::invokeExternalFunction
                    RexxActivation.cpp : RexxActivation::externalCall
            PackageManager.cpp : PackageManager::loadRequires


RexxActivation::callMacroSpaceFunction
The query to rxapi is now controlled by the option MACROSPACE / NOMACROSPACE.


==============================================================

Operations called by the test framework

[rxapi] ServiceMessage APIManager CLOSE_CONNECTION
[rxapi] ServiceMessage APIManager CONNECTION_ACTIVE
[rxapi] ServiceMessage MacroSpaceManager QUERY_MACRO
[rxapi] ServiceMessage QueueManager ADD_TO_NAMED_QUEUE
[rxapi] ServiceMessage QueueManager ADD_TO_SESSION_QUEUE
[rxapi] ServiceMessage QueueManager CLEAR_NAMED_QUEUE
[rxapi] ServiceMessage QueueManager CLEAR_SESSION_QUEUE
[rxapi] ServiceMessage QueueManager CREATE_SESSION_QUEUE
[rxapi] ServiceMessage QueueManager DELETE_NAMED_QUEUE
[rxapi] ServiceMessage QueueManager DELETE_SESSION_QUEUE
[rxapi] ServiceMessage QueueManager GET_NAMED_QUEUE_COUNT
[rxapi] ServiceMessage QueueManager GET_SESSION_QUEUE_COUNT
[rxapi] ServiceMessage QueueManager NEST_SESSION_QUEUE
[rxapi] ServiceMessage QueueManager OPEN_NAMED_QUEUE
[rxapi] ServiceMessage QueueManager PULL_FROM_NAMED_QUEUE
[rxapi] ServiceMessage QueueManager PULL_FROM_SESSION_QUEUE
[rxapi] ServiceMessage QueueManager QUERY_NAMED_QUEUE
[rxapi] ServiceMessage RegistrationManager REGISTER_LOAD_LIBRARY


rxapi operations : the ===>operations have been used by the test framework

// macro space operations
ADD_MACRO,
ITERATE_MACRO_DESCRIPTORS,
NEXT_MACRO_DESCRIPTOR,
GET_MACRO_IMAGE,
GET_MACRO_DESCRIPTOR,
CLEAR_MACRO_SPACE,
REMOVE_MACRO,
===>QUERY_MACRO,
REORDER_MACRO,
MACRO_SEND_NEXT,
ITERATE_MACROS,
NEXT_MACRO_IMAGE,
MACRO_RETRIEVE_NEXT,

// queue manager operations
===>NEST_SESSION_QUEUE,
===>CREATE_SESSION_QUEUE,
CREATE_NAMED_QUEUE,
===>DELETE_SESSION_QUEUE,
===>DELETE_NAMED_QUEUE,
===>GET_SESSION_QUEUE_COUNT,
===>GET_NAMED_QUEUE_COUNT,
===>ADD_TO_NAMED_QUEUE,
===>ADD_TO_SESSION_QUEUE,
===>PULL_FROM_NAMED_QUEUE,
===>PULL_FROM_SESSION_QUEUE,
===>CLEAR_SESSION_QUEUE,
===>CLEAR_NAMED_QUEUE,
===>OPEN_NAMED_QUEUE,
===>QUERY_NAMED_QUEUE,

// registration manager operations
REGISTER_LIBRARY,
REGISTER_ENTRYPOINT,
REGISTER_DROP,
REGISTER_DROP_LIBRARY,
REGISTER_QUERY,
REGISTER_QUERY_LIBRARY,
===>REGISTER_LOAD_LIBRARY,
UPDATE_CALLBACK,

// global API operations
SHUTDOWN_SERVER,
PROCESS_CLEANUP,
===>CONNECTION_ACTIVE,
===>CLOSE_CONNECTION,



--------------------------------------------------------------------------------------------
Someone said in comp.lang.rexx that the performances of ooRexx v4.0 on his web server are not good compared to 3.2
I have no idea of the architecture of a web server based on rexx (only one rexx processes ? several ?).
That brought me a question about rxapi and its usage for a web server.

My understanding of rxapi is that it lets share some informations between several oorexx processes (queues, global environment).


List of functions exported by rxapi.dll
Those imported by rexx.dll are tagged with "1"
Those imported by rexx.exe are tagged with "2"
Those imported by rexxutil.dll are tagged with "3"
Those imported by rxqueue.exe are tagged with "4"
Those imported by rxsubcom.exe are tagged with "5"

3 RexxAddMacro
14 RexxAddQueue
RexxAllocateMemory
3 RexxClearMacroSpace
14 RexxClearQueue
1 RexxCreateQueue
1 RexxCreateSessionQueue
1 RexxDeleteQueue
1 RexxDeleteSessionQueue
RexxDeregisterExit
1 RexxDeregisterFunction
5 RexxDeregisterSubcom
3 RexxDropMacro
123 RexxFreeMemory
3 RexxLoadMacroSpace
5 RexxLoadSubcom
1 RexxOpenQueue
1 RexxPullFromQueue
RexxPullQueue
RexxQueryExit
1 RexxQueryFunction
13 RexxQueryMacro
14 RexxQueryQueue
5 RexxQuerySubcom
1 RexxQueueExists
RexxRegisterExitDll
RexxRegisterExitExe
1 RexxRegisterFunctionDll
RexxRegisterFunctionExe
5 RexxRegisterSubcomDll
RexxRegisterSubcomExe
3 RexxReorderMacro
1 RexxResolveExit
1 RexxResolveMacroFunction
1 RexxResolveRoutine
1 RexxResolveSubcom
3 RexxSaveMacroSpace
RexxShutDownAPI


================================================================================
Macrospace
================================================================================

Etude d'un point d'entrée dans l'API, appelé par
RexxActivation::callMacroSpaceFunction
(lorsque le macrospace n'est pas désactivé)
rexxapi\client\MacroSpaceApi.cpp
    RexxReturnCode RexxEntry RexxQueryMacro(
        const char     *name,                /* name to search for         */
        unsigned short *pos)                 /* pointer for return of pos  */
    {
        ENTER_REXX_API(MacroSpaceManager)
        {
            size_t order = 0;

            RexxReturnCode ret = lam->macroSpaceManager.queryMacro(name, &order);
            *pos = (unsigned short)order;
            return ret;
        }
        EXIT_REXX_API();
    }


D'où vient MacroSpaceManager ? type énuméré
rexxapi\common\ServiceMessage.hpp
    // definitions of server message targets
    typedef enum
    {
        QueueManager,
        RegistrationManager,
        MacroSpaceManager,
        APIManager

    } ServerManager;


D'où vient ENTER_REXX_API ? macro
rexxapi\client\RexxAPI.h
    #define ENTER_REXX_API(target) \
        LocalAPIContext context(target); \                      // JLF : no cost
        try                           \
        {                             \
            LocalAPIManager *lam = context.getAPIManager(); \   // JLF : localManager = LocalAPIManager::getInstance()

    #define EXIT_REXX_API()            \
        }                              \
        catch (ServiceException *e)    \
        {                              \
            return context.processServiceException(e); \
        }                              \
        catch (std::bad_alloc &)      \
        {                              \
            return RXAPI_MEMFAIL;      \
        }


LocalAPIManager::getInstance appelé par :
    rexxapi\client\ClientMessage.cpp
        ClientMessage::send
    rexxapi\client\LocalAPIContext.cpp
        LocalAPIContext::getAPIManager
            ENTER_REXX_API


LocalAPIManager::getInstance implémenté ici :
    rexxapi\client\LocalAPIManager.cpp
        LocalAPIManager *LocalAPIManager::getInstance()
        {
            Lock lock(messageLock, "LocalAPIManager::getInstance", 0);                     // make sure we single thread this
            if (singleInstance == NULL)
            {
                // create an intialize this.  If this fails, an exception is thrown
                singleInstance = new LocalAPIManager();
                // to the process-specific initialization now.
                singleInstance->initProcess();
            }
            return singleInstance;
        }


Donc toutes les occurences de ENTER_REXX_API vont donner les points d'entrée
    rexxapi\client\MacroSpaceApi.cpp
        RexxAddMacro
        RexxDropMacro
        RexxClearMacroSpace
        RexxSaveMacroSpace
        RexxLoadMacroSpace
        RexxQueryMacro
        RexxReorderMacro
        RexxResolveMacroFunction
    rexxapi\client\QueuesAPI.cpp
        RexxCreateQueue
        RexxOpenQueue
        RexxQueueExists
        RexxDeleteQueue
        RexxClearQueue
        RexxQueryQueue
        RexxAddQueue
        RexxPullFromQueue
        RexxCreateSessionQueue
    rexxapi\client\RegistrationAPI.cpp
        RexxRegisterSubcomDll
        RexxRegisterSubcomExe
        RexxDeregisterSubcom
        RexxQuerySubcom
        RexxResolveSubcom
        RexxLoadSubcom
        RexxRegisterExitDll
        RexxRegisterExitExe
        RexxDeregisterExit
        RexxQueryExit
        RexxResolveExit
        RexxRegisterFunctionDll
        RexxRegisterFunctionExe
        RexxDeregisterFunction
        RexxQueryFunction
        RexxResolveRoutine


Dans LocalAPIManager::getInstance
    singleInstance->initProcess()
    fait appel à 
        establishServerConnection
